package com.enjoyor.soa.traffic.rest.efoms.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.enjoyor.soa.traffic.frame.annotation.Auth;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IDateMonitorConsumeService;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Auth
@RestController
@RequestMapping({ "/DateMonitor" })
@Api("DateMonitorController")
@CrossOrigin
public class DateMonitorController {

	@Autowired
	private IDateMonitorConsumeService dateMonitorConsumeService;
	
	@GetMapping(value = { "/getDateMonitorChar" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
    @ApiOperation("查询监测条形图")
	@ApiImplicitParams({
    	@ApiImplicitParam(name = "typeCode", value = "类型编号", paramType = "query", dataType = "String"),
    	@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String")})
	public ResultPojo getDateMonitorChar(
			@RequestParam(defaultValue = "",value="typeCode",required=false) String typeCode,
			@RequestParam(defaultValue = "",value="devId",required=false) String devId,
			HttpServletRequest request) {
		return dateMonitorConsumeService.getDateMonitorChar(typeCode, devId);
	}
	
	@GetMapping(value = { "/getDateMonitorReal" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
    @ApiOperation("查询监测实时数据")
	@ApiImplicitParams({
    	@ApiImplicitParam(name = "typeCode", value = "类型编号", paramType = "query", dataType = "String"),
    	@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String")})
	public ResultPojo getDateMonitorReal(
			@RequestParam(defaultValue = "",value="typeCode",required=false) String typeCode,
			@RequestParam(defaultValue = "",value="devId",required=false) String devId,
			HttpServletRequest request) {
		return dateMonitorConsumeService.getDateMonitorReal(typeCode, devId);
	}
}
